<?
require_once('config.php');
$action = getValue('action','str','POST','');
$cat_id = getValue('cat_id');
$array_info_cat = array();
if($action == 'submit'){
   $cat_name   = getValue('cat_name','str','POST');
   $sql_update = "UPDATE category
                  SET cat_name = '" .$cat_name. "' 
                  WHERE cat_id = $cat_id";
   echo '<span style="color: #01B42C;font-size: 14px;font-weight: bold;">Cập nhật thành công</span>';
   $db_update = new db_execute($sql_update);
   
}
if($cat_id > 0){
   $db_query = new db_query("SELECT cat_name
                              FROM category WHERE cat_id=$cat_id");
   $array_info_cat = $db_query->resultArray();
   $cat_name = $array_info_cat[0]['cat_name'];
   
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cập nhật <?=$moduol_name?></title>
   <?=$css_global?>
   <?=$js_global?>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
    $(document).on('click','.reload_tab' ,function(){
      window.location.reload();
    });
  });
  </script>
</head>
<div class="row-fluid">
   <div class="head">
      <div class="isw-grid"></div>
      <h1>Cập nhật <?=$moduol_name?></h1>      
      <div class="reload_tab" title="Reload"></div>                         
      <div class="clear"></div>
   </div>
   <div class="block-fluid">
      <form class="form-horizontal" name="add" action="" method="POST" enctype="multipart/form-data"  onsubmit="">
         <input type="hidden" name="action" value="submit" />
         <fieldset>
            <div class="control-group">
               <label class="control-label" for="input01">Tên thể loại video</label>
               <div class="controls">
						<input type="text" class="input-xlarge tooltip-right span8" id="input01" name="cat_name" value="<?=$cat_name?>" title="Tên thể loại video"/>
					</div>
            </div>
            <div class="form-actions">
					<button type="submit" class="btn btn-info">Cập nhật</button>
					<button type="reset"  class="btn btn-warning">Làm lại</button>
				</div>
         </fieldset>
      </form>
   </div> 
</div>